package com.fenghongzhang.a18102;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.callback.NavigationCallback;
import com.alibaba.android.arouter.launcher.ARouter;

public class MainActivity extends AppCompatActivity {

    //备注
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }

    public void send(View view) {
//        Intent intent = new Intent(this, Main2Activity.class);
//        startActivity(intent);
        //无参跳转
//        ARouter.getInstance().build("/main2/one").navigation();

//        //有参数跳转
//        ARouter.getInstance().build("/main2/one")
//                .withString("name","韩信")
//                .withInt("age",18)
//                .withObject("user",new User("李白","110")) //序列化
//                .navigation();

        //new Blankfragment
//        BlankFragment fragment = (BlankFragment) ARouter.getInstance().build("/main2/fg").navigation();
//
//        getSupportFragmentManager().beginTransaction().add(R.id.ll,fragment).commit();


//        ARouter.getInstance().build("/main2/one").navigation(this, new NavigationCallback() {
//            @Override
//            public void onFound(Postcard postcard) {
//
//            }
//
//            @Override
//            public void onLost(Postcard postcard) {
//
//            }
//
//            @Override
//            public void onArrival(Postcard postcard) {
//
//            }
//
//            @Override
//            public void onInterrupt(Postcard postcard) {
//                runOnUiThread(new Runnable() {
//                    @Override
//                    public void run() {
//                        Toast.makeText(MainActivity.this, "密码拦截", Toast.LENGTH_SHORT).show();
//                    }
//                });
//            }
//        });

        //模块之间的跳转
         ARouter.getInstance().build("/shop/one").navigation();
    }
}
